package cn.tedu.charging.cost.controller;

import cn.tedu.charging.common.pojo.param.ChargingProcessParam;
import cn.tedu.charging.common.pojo.vo.ChargingProcessVO;
import cn.tedu.charging.cost.service.ChargingCostService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.tedu.charging.common.JsonResult;

/**
 * @Author: Miyako
 * @Date: 2024-10-22-15:24
 * @Description:
 */
@RestController
@Slf4j
@Api("计费服务")
@RequestMapping("cost")
public class CostController {

    @Autowired
    ChargingCostService  chargingCostService;

    @ApiOperation("计算电费")
    @PostMapping("calculate")
    public JsonResult<ChargingProcessVO> calculateCost(@RequestBody ChargingProcessParam chargingProcessParam){
                log.debug("计价服务被调用了捏");
   ChargingProcessVO chargingProcessVO=chargingCostService.calculateCost(chargingProcessParam);
           return JsonResult.ok(chargingProcessVO);

    }
}
